/**
 * 
 */
package com.facebookfetcher.main;

import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.InputStreamReader;

/**
 * @author piglet
 *
 */
public class RecreateDB {
	private static final FacebookFetcher fbFetcher = new FacebookFetcher();
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try{
			// Open the file that is the first 
			// command line parameter
			FileInputStream fstream = new FileInputStream("fbappinfo.txt");
			// Get the object of DataInputStream
			DataInputStream in = new DataInputStream(fstream);
			BufferedReader br = new BufferedReader(new InputStreamReader(in));
			String strLine;
			//Read File Line By Line
			int counter=0;
			while ((strLine = br.readLine()) != null)   {
				// Print the content on the console				
				if(!strLine.isEmpty())
				{
					counter++;
					System.out.println (counter+" "+strLine);
					fbFetcher.fetchFBApp(strLine, true);
					Thread.sleep(1500);
				}
			}
			//Close the input stream
			in.close();
		}catch (Exception e){//Catch exception if any
			System.err.println("Error: " + e.getMessage());
		}
		System.out.println("done!");
	}

}
